{include file="common/head"}
<head>
<title>教练信息编辑</title>
    <link rel="stylesheet" href="/static/flatpickr/flatpickr.min.css">
    <script src="/static/flatpickr/flatpickr.js"></script>

<style>
  label{width: 18%;}
  .form-control{display:inline-block;width: 80%;}
  h2{height:50px;line-height: 30px;}
  .box{border:1px solid #ccc;padding: 20px;box-shadow: 1px 1px 4px #888;position: relative;}  
</style>
</head>
<body style="">
    <div class="container p-3  " style="margin-left: 10px;"  >
    <form method="post" action="/index.php/customer/edit/type/2" enctype="multipart/form-data">
      <input type="hidden" name="id" id="id" value="{$data.id}" />
      <div class="row">
        <div class="col box" style="margin-right:10px;">
          <h2>基本资料   编号:{$data.id}</h2>     
          <div class="mb-3">
            <label for="name" class="form-label">姓名:</label>
            <input type="text" class="form-control" id="name" name="name" value="{$data.name}" placeholder="姓名" />
          </div>
          <div class="mb-3">
            <label for="mobile" class="form-label">手机号码:</label>
            <input type="text" class="form-control" id="mobile" name="mobile" value="{$data.mobile}" placeholder="手机号码"  />
          </div>
          <div class="mb-3">
            <label for="id_card" class="form-label">身份证号码:</label>
            <input type="text" class="form-control" id="id_card" name="id_card" value="{$data.id_card}" placeholder="身份证号码" />
          </div>  
              
          <div class="mb-3">
            <label for="address" class="form-label">现居地址:</label>
            <input type="text" class="form-control" id="address" name="address" value="{$data.address}" placeholder="现居地址" />
          </div>      
          <div class="mb-3">
            <label for="wx" class="form-label">微信号:</label>
            <input type="text" class="form-control" id="wx" name="wx" value="{$data.wx}" placeholder="微信号" />
          </div>
<!--           <div class="mb-3">
            <label for="birth_date" class="form-label">出生日期:</label>
            <input type="text" class="form-control" id="birth_date" name="birth_date" value="{$data.birth_date}" placeholder="出生日期" />
          </div> -->

          <div class="mb-3">
            <label for="file" class="form-label">上传图片:</label>
            <img src="{$data.image}" style="height: 100px;border:1px solid #ccc;"/>
            <input type="file"  name="file" /> <br> 
          </div>           
        </div>
        <div class="col box" >
          <h2>任职资料</h2>   

          <div class="mb-3">
            <label for="dept_id" class="form-label">任职驾校:</label>
            <select id="dept_id" name="dept_id" class="form-control">
              <option value="">未选择驾校</option>
                {foreach $school as $k=>$v}
                    {if $v['id']==$data['dept_id']}
                        <option value="{$v['id']}" selected >{$v['name']}</option>
                    {else}
                        <option value="{$v['id']}" >{$v['name']}</option>
                    {/if}
                {/foreach}
            </select>
          </div>      
          <div class="mb-3">
            <label for="tel" class="form-label">准教车型:</label>
            <input type="text" class="form-control" id="tel" name="tel" value="{$data.tel}" placeholder="准教车型,C1,C2..." />        
          </div>        
          <div class="mb-3">
            <label for="sex" class="form-label">性别:</label>
              <input type="radio" class="form-check-input" id="radio1" name="sex" value="1" {if $data.sex==1} checked {/if}/> 
              <label class="form-check-label" for="radio1">男士</label>
              <input type="radio" class="form-check-input" id="radio2" name="sex" value="2" {if $data.sex==2} checked {/if}/>
              <label class="form-check-label" for="radio2">女士</label>
          </div>
          <div class="mb-3">
            <label for="job_years" class="form-label">教龄:</label>
            <input type="number" class="form-control" id="job_years" name="job_years" value="{$data.job_years}" placeholder="教龄" />
          </div>

          <div class="mb-3">
            <label for="tel" class="form-label">教练级别:</label>
            <select class="form-control" name="trainer_level" id="trainer_level">
              {foreach $t_levels as $k=>$v}
                <option value="{$k}" {if $k==$data.trainer_level}selected{/if}>{$v}</option>
              {/foreach}
            </select>
          </div>
          <div class="mb-3">
            <label for="desc" class="form-label">个人简介:</label>
            <textarea class="form-control" id="desc" name="desc" style="height: 60px;">{$data.desc}</textarea>
          </div>


          <div class="mb-3">
            <label for="status" class="form-label">状态:</label>
              <input type="radio" class="form-check-input" id="radio3" name="status" value="1" {if $data.status==1}checked{/if} /> 
              <label class="form-check-label" for="radio3">正常</label>
              <input type="radio" class="form-check-input" id="radio4" name="status" value="2" {if $data.status==2}checked{/if} />
              <label class="form-check-label" for="radio4">关闭</label>
           </div>

          <div class="text-left" style="margin-top: 10px;border:0 solid #ccc;">
            <button  type="button" class="btn btn-primary" onclick="doSave()">保存修改</button>
          </div>

        </div>
      </div>


      

    </form>
    </div>

<script type="text/javascript">
    flatpickr("#birth_date", {});
    $(".birth_date").flatpickr({
        enableTime: true,
        dateFormat: "Y-m-d H:i:s",
    });
  
    function doSave(){
      if(!$("#name").val()) {
        layer.msg("无效的姓名!");
        return 0;
      }    
      if(!$("#mobile").val()) {
        layer.msg("无效的电话!");
        return 0;
      }

      if(!$("#id_card").val()){
        layer.msg("无效的身份证号码！");
        return;
      }

      if(!$("#address").val()){
        layer.msg("无效的地址！");
        return;
      }

      //询问框
      layer.confirm('是否确定保存?', {
        btn: ['是的','取消'] //按钮
      }, function(){
        $('form').submit();
      }, function(){
        layer.msg("取消!");
        return 0;
      });
    }

</script>


</body>
</html>
